﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using log4net;
using RealState.BLL;

namespace RealState.W.AdminControl
{
    public partial class NewsList : System.Web.UI.UserControl
    {
        protected ILog log = LogManager.GetLogger(typeof(NewsList));
        private NewsBLL m_NewsBLL;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                m_NewsBLL = new NewsBLL();
                try
                {
                    rptCategories.DataSource = m_NewsBLL.GetNewss();
                    rptCategories.DataBind();
                }
                catch (Exception ex)
                {
                    log.Error(ex.Message);
                }
                finally {
                    m_NewsBLL = null;
                }
            }
        }
        protected string GetStatus(object obj)
        {
            if (obj.ToString().Equals("1"))
                return "Hiển thị";
            return "Ẩn";
        }


        protected string GetTime(object obj)
        {
            return Convert.ToDateTime(obj).ToString("dd/MM/yyyy");
        }
    }
}